home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr15 / ixe130.zip / IXETEST.C < prev    next >
C/C++ Source or Header  |  1993-05-10  |  2KB  |  103 lines

  1. /*
  2.     Filename    :   ixetest.c
  3.     Author      :   Ray E. Bornert II
  4.     Date        :   1993-MAY-07
  5.  
  6.     Copyright (C) 1993 HixoxiH Software.  All rights reserved
  7. */
  8.  
  9. /*
  10. compile line for 80286 and below:
  11.     bcc -ml ixetest.c
  12. compile line for 80386 and above:
  13.     bcc -ml -3 ixetest.c
  14. */
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <conio.h>
  19. #include <alloc.h>
  20. #include <dos.h>
  21. #include <mem.h>
  22. #include <bios.h>
  23. #include "ixeblit.h"
  24.  
  25. unsigned char *VM = (unsigned char *)MK_FP(0xA000,0);
  26. unsigned char far *ixe;
  27.  
  28. void VIDEOMODE(int n)
  29. {
  30.     struct REGPACK reg;
  31.     reg.r_ax = n;
  32.     intr(0x10,®);
  33. }
  34.  
  35. void main( int argc, char *argv[] )
  36. {
  37.     long t0,t1,blits,seconds;
  38.     long ixeLength,i=0;
  39.     unsigned int ixeWidth,ixeHeight;
  40.     int c;
  41.     FILE *fixe;
  42.     
  43.     //this will not have any effect if emm386 is installed
  44.     disableInt13();
  45.     atexit(enableInt13);
  46.     
  47.     if (argc < 2)
  48.     {
  49.         printf("I need an .IXE to test\n");
  50.         return;
  51.     }
  52.  
  53.     ixe = (unsigned char *)farmalloc(65536L); //can't be larger
  54.     if (!ixe)
  55.     {
  56.         printf("Could not allocate 64k buffer for ixe\n");
  57.         return;
  58.     }
  59.  
  60.     fixe = fopen(argv[1],"rb");
  61.     if (!fixe)
  62.     {
  63.         printf("Could not open %s\n",argv[1]);
  64.         return;
  65.     }
  66.     while ((c=fgetc(fixe))!=EOF)
  67.         ixe[i++]=c;
  68.     fclose(fixe);
  69.  
  70.     ixeLength = i;
  71. //  ixeWidth = *(unsigned short *)(&(ixe[ixeLength-4]));
  72.     ixeHeight = *(unsigned short *)(&(ixe[ixeLength-2]));
  73.  
  74.     if (ixe[0] == 0x8B)
  75.     {
  76.         printf("Only non-planar ixe's for this example, Please.\n");
  77.         return;
  78.     }
  79.     
  80.     VIDEOMODE(0x13);
  81.     
  82.     t0=biostime(0,0L);
  83.     for(blits=0;;blits++)
  84.     {
  85. //      ixeBlitXY(VM,ixe,320,random(320),random(200));
  86.         ixeBlitXY16(VM,ixe,320,random(320),random(200-ixeHeight));
  87. //      ixeBlitXY16(VM,ixe,320,blits%320,blits/320);
  88. //      ixeBlitXY32(VM,ixe,320,random(320),random(200));
  89.         if (kbhit())
  90.             break;
  91.     }
  92.     t1=biostime(0,0L);
  93.     
  94.     VIDEOMODE(3);
  95.     
  96.     seconds = (((t1-t0)*10L)/182);
  97.     if (seconds == 0) 
  98.         return;
  99.     printf("%li blits / second\n",blits/seconds);
  100.  
  101. }
  102.  
  103.